#include "unp.h"

void
str_cli(FILE *fp, int sockfd) {
    char        sendline[MAXLINE], recvline[MAXLINE];

    while(fgets(sendline, MAXLINE, fp) != NULL) {

        ssize_t n = strlen(sendline);
        if (n != writen(sockfd, sendline, n)) 
            err_sys("writen error\n");

        if (read(sockfd, recvline, MAXLINE) == 0) {
            perror("reading from server.");
            exit(1);
        }

        fputs(recvline, stdout);
    }
}

